package com.commons;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.metaparadigm.jsonrpc.JSONRPCBridge;
/**
 * 
 * @author uday.kumar
 *
 */
public class AjaxService implements HttpSessionListener {

	public void sessionCreated(HttpSessionEvent sessionEvent) {

		//System.out.println("sessionCreated");
		HttpSession session = sessionEvent.getSession();
		JSONRPCBridge json_bridge = null;
		json_bridge = (JSONRPCBridge) session.getAttribute("JSONRPCBridge");
		if (json_bridge == null) {
			json_bridge = new JSONRPCBridge();
			session.setAttribute("JSONRPCBridge", json_bridge);
		}
		json_bridge.registerObject("wards", new AjaxHelper(session.getServletContext()));
		
	}

	public void sessionDestroyed(HttpSessionEvent arg0) {
		//System.out.println("sessionDestroyed");
	}
}
